<?php

/**
 * Erra_Fields_Text - Simple text field
 *
 * @package
 * @author Alexis Eric
 * @copyright Copyright (c) 2012 - Erra Prod
 * @version $1.0$
 * @access public
 */
class Erra_Fields_Time extends Erra_Fields_Base_Field {

    protected $_size = 40;

    function __construct($objectId) {
        parent::__construct($objectId);
        $this->setDatabaseType('varchar', 64);
    }

    /**
     * Erra_Fields_Text::editInstance() - Shows a simple text field
     *
     * @param mixed $lang
     * @return
     */
    public function editInstance(Array $extraProperties = null) {
        $extraProperties['class'] = isset($extraProperties['class']) ? $extraProperties['class'] . ' jquery-timepicker-input' : ' jquery-timepicker-input';

        $res = '<div class="erra-form-field-instance">';
        $res .= $this->outputFieldHeader();

        $res .= '<input type="text" name="' . $this->getHtmlName() . '" id="' . $this->getHtmlId() . '" value="' . $this->getRawData() . '"  size="' . $this->_size . '" ' . $this->getHtmlAttributes($extraProperties) . '/>';
        $res .= '</div>';
        return $res;
    }


    function toHtml($displayParameters = null) {
        return $this->getRawData();
    }

    /** GETTERS AND SETTERS * */
    public function getSize() {
        return $this->_size;
    }

    public function setSize($size) {
        $this->_size = $size;
        return $this;
    }

}